import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lib_uikit/widgets/text/gt_text.dart';

/// @Title   自定义TextSpan（1：使用自定义字体，2：新增支持行间距）
/// 目前有个问题：使用GTTextSpan后如果不设置style不会默认使用父组件的textStyle，需要设置style
/// @Author: bryce
/// @CreateDate: 2023年10月16日16:07:12
class GTTextSpan extends TextSpan {
  GTTextSpan({
    String? text,
    List<InlineSpan>? children,
    TextStyle? style,
    GestureRecognizer? recognizer,
    MouseCursor? mouseCursor,
    PointerEnterEventListener? onEnter,
    PointerExitEventListener? onExit,
    String? semanticsLabel,
    Locale? locale,
    bool? spellOut,
    double? fontSize,
    Color? textColor,
    FontWeight? fontWeight,
    FontStyle? fontStyle,

    /// 行间距数值 默认4
    double lineSpace = 4,
  }) : super(
          text: text,
          children: children,
          recognizer: recognizer,
          mouseCursor: mouseCursor,
          onEnter: onEnter,
          onExit: onExit,
          semanticsLabel: semanticsLabel,
          locale: locale,
          spellOut: spellOut,
          style: getInitTextStyle(null, style, fontSize, textColor, fontWeight, fontStyle, lineSpace),
        );
}
